package com.example.springboot.controller;

import com.example.springboot.entity.Article;
import com.example.springboot.entity.Res;
import com.example.springboot.service.Impl.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/article")
public class ArticleController {
    @Autowired
    private ArticleService articleService;

    @GetMapping
    public Res<Article> getArticleById(@RequestParam  Integer id) {
        Article article =articleService.getArticleById(id);
        return new Res<Article>().data(article).code(200).msg("success");
    }
}
